﻿using System;
using Beaker;
using OpenCube.Nbt.Mapping;

namespace OpenCube.Model.Primitives.Converters
{
	/// <summary>
	/// Converts a long with game ticks to <see cref="GameTimeSpan"/> and back.
	/// </summary>
	public sealed class LongGameTimeSpanConverter
		: NbtSimpleTypeConverter<GameTimeSpan, long>
	{
		protected override GameTimeSpan ConvertToModelValue(long nbtValue)
		{
			return new GameTimeSpan(nbtValue);
		}

		protected override Maybe<long> ConvertToNbtValue(GameTimeSpan modelValue)
		{
			throw new NotImplementedException();
		}
	}

	/// <summary>
	/// Converts a long with game ticks to <see cref="GameTimeSpan"/> and back.
	/// </summary>
	public sealed class IntGameTimeSpanConverter
		: NbtSimpleTypeConverter<GameTimeSpan, int>
	{
		protected override GameTimeSpan ConvertToModelValue(int nbtValue)
		{
			return new GameTimeSpan(nbtValue);
		}

		protected override Maybe<int> ConvertToNbtValue(GameTimeSpan modelValue)
		{
			throw new NotImplementedException();
		}
	}
}
